package miningMindsUtil;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;

import functions.FileFunction;
import functions.TermFunction;
import parameter.*;

public class ModifyFileListContents {
	public static void main(String args[]){
		String sourcePath = Path.CATEGORY_MODEL_TFIDF_PATH;
		String targetPath = Path.CATEGORY_MODEL_TFIDF_PATH;
		
		Map<String, Map<String,Double>> map = FileFunction.readMapStr_StrDou(sourcePath);
		Map<String, Map<String,Double>> map2 = new HashMap<String, Map<String, Double>>();
		
		for (Entry<String, Map<String, Double>> entry : map.entrySet()) {
			String key = entry.getKey();
			System.out.println("Loading "+key);
			Map<String, Double> submap2 = new HashMap<String,Double>();
			Map<String, Double> value = entry.getValue();
			//------  MODIFICATION PROCESS  --------//

			for (Entry<String, Double> entry2 : value.entrySet()) {
				String key2 = entry2.getKey();
				Double value2 = entry2.getValue();
				
				submap2.put(key2, value2);
			}
			
			map2.put(key, TermFunction.getNorm(submap2));
			//-----------------------------------------//
		}
		FileFunction.writeMapStr_StrDou(map2, targetPath);
		System.out.println("complete");
	}
}
